import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ${USER}
 * Date: ${YEAR}-${MONTH}-${DAY}
 * Time: ${TIME}
 */
public class Main {
    static void move(String pos1,String pos2){
        System.out.println(pos1 + "->" + pos2);
    }
    static void hanIo(int n,String a,String b,String c) {
        if( n == 1){
            move(a,c);
            return ;
        }else {
        hanIo(n - 1,a,c,b);
        move(a,c);
        hanIo(n - 1,b,a,c);}
    }
    public static void main(String[] args) {
        System.out.println("请输入圆盘个数");
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        hanIo(n,"A","B","C");
    }
}